<?php
GLOBAL $CFG;
require_once('../../../config.php');

require_once($CFG->libdir . '/formslib.php');
require_once($CFG->dirroot . '/local/blackboxsurvey/lib.php');
require_once($CFG->dirroot . "/local/blackboxsurvey/forms.php");

//yeu cau login,sau khi login tu dong chuyen sang trang chu
global $USER;
if ($USER->id == null){
    $SESSION->homepage = true;
    require_login($SITE);
}
if($SESSION->homepage){
    $SESSION->homepage = null;
    redirect( $CFG->wwwroot);
}

//class
require_once($CFG->dirroot . "/local/blackboxsurvey/class/survey.php");
require_once($CFG->dirroot . "/local/blackboxsurvey/class/user.php");

$path = $CFG->wwwroot.'/local/blackboxsurvey/admin/manage_survey.php';
$path_image = $CFG->wwwroot .'/local/blackboxsurvey/image/';

//Them thanh menu ngang ung voi trang trong duong link
//navigation_node::override_active_url(new moodle_url($path, array('param'=>'value')));

/* Chuan bi trang web can hien thi */	
//$url = new moodle_url($path);
//$PAGE->set_url($url);
//$PAGE->set_title('Survey Detail');
//$PAGE->set_heading('Survey Detail');
//$PAGE->set_pagelayout('standard');
//
//echo $OUTPUT->header();

/* Viet code xu ly o day */
$id = optional_param('id',null, PARAM_TEXT);
$c_survey = new b_survey();
$survey = $c_survey->get_survey_byID($id);
$array['program'] = $survey->program_name;
$str = '<div id="Filter" > Search: <input type=text id="FilterTextBox" name="FilterTextBox" size="40"/><img onclick="clear_filter_edit_only();" style="cursor:pointer;" src="'.$path_image.'clear.jpg"/></div><br>';
$str .= $c_survey->load_survey_detail_table($id);
$array['str'] = $str;

$mform = new form_survey_detail(null, $array);
$mform->display();
echo "<script type='text/javascript'>survey_detail_filter();</script>"; 
/*------Ket thuc doan code cua ban-------*/
//echo $OUTPUT->footer();
